package com.richard.springcloud.base;

import java.io.Serializable;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ComnResult<T> {
	//404 not_found
	private Integer code;
	private String message;
	private T data;
	private boolean success;
	
	public ComnResult(Integer code, String message) {
		this(code, message, null, false);
	}
	
	public ComnResult (T t) {
		this.data = t;
		this.success = true;
		this.code = 0;
	}
	
	public ComnResult (boolean succ) {
		this.success = succ;
		this.code = 0;
	}
	
	public static ComnResult succ() {
		return new ComnResult(true);
	}
	public static ComnResult succ(Serializable t) {
		return new ComnResult(t);
	}
}
